<template>
	<div>
		<el-drawer title="" :visible.sync="drawer" :direction="direction" :before-close="handleClose" custom-class="drawer-info">
			<div class="info-item">
				<h5 class="from-title">基本信息</h5>
				<div class="form-item">
					<label class="form-item-label">短信编码:</label>
					<div class="form-item-content">{{ objInfo.smsCode }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">手机号:</label>
					<div class="form-item-content">{{ objInfo.mobile }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">参数1:</label>
					<div class="form-item-content">{{ objInfo.params1 }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">参数2:</label>
					<div class="form-item-content">{{ objInfo.params2 }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">参数3:</label>
					<div class="form-item-content">{{ objInfo.params3 }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">参数4:</label>
					<div class="form-item-content">{{ objInfo.params4 }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">状态 0生效 1失效:</label>
					<div class="form-item-content">{{ objInfo.statusName }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">创建时间:</label>
					<div class="form-item-content">{{ objInfo.createDate }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">短信类型 0：注册验证码 1：登录验证码:</label>
					<div class="form-item-content">{{ objInfo.typeName }}</div>
				</div>
			</div>
		</el-drawer>
	</div>
</template>
<script>
import { logsmsInfo } from "@/api/log/logsms.js"
import { enumList } from "@/api/public.api.js"
export default {
	data() {
		return {
			drawer: true,
			direction: "rtl",
			objInfo: {},
			LogSmsStatus_logList: [],
			LogSmsType_logList: [],
		}
	},
	created() {},
	methods: {
		queryEnumList() {
			this.LogSmsStatus_logList = []
			enumList("LogSmsStatus", "log").then(resp => {
				if (resp.code == 0) {
					this.LogSmsStatus_logList = resp.data
				}
			})
			this.LogSmsType_logList = []
			enumList("LogSmsType", "log").then(resp => {
				if (resp.code == 0) {
					this.LogSmsType_logList = resp.data
				}
			})
		},
		init(id) {
			this.queryEnumList()
			if (id) {
				logsmsInfo(id).then(res => {
					this.objInfo = res.data
					let statusObj = this.LogSmsStatus_logList.find(item => {
						return item.code == this.objInfo.status
					})
					this.objInfo.statusName = statusObj ? statusObj.name : ""
					let typeObj = this.LogSmsType_logList.find(item => {
						return item.code == this.objInfo.type
					})
					this.objInfo.typeName = typeObj ? typeObj.name : ""
				})
			}
			this.drawer = true
		},
		// 关闭抽屉
		handleClose(done) {
			done()
		},
	},
}
</script>
<style scoped>
.from-title {
	margin-bottom: 20px;
	padding: 0 20px 20px 20px;
	font-size: 16px;
	color: #17233d;
	border-bottom: 1px solid #eee;
}
.info-item {
	margin-bottom: 40px;
}

.form-item {
	margin-bottom: 20px;
	font-size: 14px;
}
.form-item-label {
	text-align: right;
	float: left;
	width: 25%;
}
.form-item-content {
	margin-left: 30%;
	width: 70%;
}
</style>
